package jwdt.xadmin.goods.action;

import jwdt.common.action.BaseAction;
import jwdt.xadmin.goods.bean.TMeetingRoom;
import jwdt.xadmin.goods.service.MeetingRoomManageService;

import com.ezerg.db.ext.PageUtil;
import com.ezerg.web.Form;
import com.ezerg.web.Module;
import com.ezerg.web.Page;
import com.ezerg.web.annotation.Controller;
import com.ezerg.web.annotation.RequestMapping;

@Controller("/xadmin/goods")
public class MeetingRoomManageAction extends BaseAction {
	
	MeetingRoomManageService meetingRoomManageService = app.getBean("MeetingRoomManageService");
	
	@RequestMapping("/selectMeetingRoom")
	public Page doSelectMeetingRoom(Form f, Module m)throws Exception{
		PageUtil pu = (PageUtil) f.copy2Class(PageUtil.class);
		return m.getWritePage(f, meetingRoomManageService.selectMeetingRoom(pu).toJson());
	}
	
	@RequestMapping("/selectUsedMeetingRoom")
	public Page doSelectUsedMeetingRoom(Form f, Module m)throws Exception{
		return m.getJsonPage(f, meetingRoomManageService.selectUsedMeetingRoom());
	}
	
	@RequestMapping("/selectOneMeetingRoom")
	public Page doSelectOneMeetingRoom(Form f, Module m)throws Exception{
		int roomid = f.getInt("roomid");
		return m.getJsonPage(f, meetingRoomManageService.selectMeetingRoom(roomid));
	}

	@RequestMapping("/saveMeetingRoom")
	public Page doSaveMeetingRoom(Form f, Module m)throws Exception{
		int roomid = f.getInt("roomid");
		TMeetingRoom obj =  (TMeetingRoom) f.copy2Class(TMeetingRoom.class);
		return m.getJsonPage(f, meetingRoomManageService.saveMeetingRoom(roomid, obj));
	}
	
	@RequestMapping("/delMeetingRoom")
	public Page doDelMeetingRoom(Form f, Module m)throws Exception{
		int roomid = f.getInt("ids");
		return m.getJsonPage(f, meetingRoomManageService.delMeetingRoom(roomid));
	}
	
}
